#ifndef	__BFX_REFXMLENTITYREFERENCE_H__
#define	__BFX_REFXMLENTITYREFERENCE_H__

namespace BFX
{

//////////////////////////////////////////////////////////////////////////////

// Represents an entity reference node.
class REFXMLEntityReference : public REFXMLLinkedNode
{
	friend class REFXMLNode;
public:
	REFXMLEntityReference(const UniString& strName, REFXMLDocument* pDoc);
	virtual ~REFXMLEntityReference();

	// Gets the name of the node.
	virtual UniString GetName() const;

	// Gets the name of the node without the namespace prefix.
	virtual UniString GetLocalName() const;

	// Gets or sets the value of the node.
	virtual UniString GetValue() const;
	virtual void SetValue(const UniString& strValue);

	// Gets the type of the node.
	virtual XMLNodeType GetNodeType() const;

	// Saves the node to the specified XmlWriter.
	virtual void WriteTo(REFXMLWriter* w) const;
	// Saves all the children of the node to the specified XmlWriter.
	virtual void WriteContentTo(REFXMLWriter* w) const;

	virtual UniString GetBaseURI() const;

protected:
	virtual bool IsContainer() const;

	virtual void SetParent(REFXMLNode* pNode);
	virtual void SetParentForLoad(REFXMLNode* pNode);

	virtual REFXMLLinkedNode* GetFirstNode() const;
	virtual void SetFirstNode(REFXMLLinkedNode* pNode);

	virtual REFXMLLinkedNode* GetLastNode() const;
	virtual void SetLastNode(REFXMLLinkedNode* pNode);

	virtual bool IsValidChildType(XMLNodeType type) const;

	// Returns where the entity reference node's children come from
	UniString GetChildBaseURI() const;
	UniString ConstructBaseURI(const UniString& strBaseURI, const UniString& strSystemId) const;

protected:
	UniString	m_strName;
	REF<REFXMLLinkedNode>	m_pFirstChild;
	REFXMLLinkedNode*		m_pLastChild;
};

}	//	namespace	BFX

#endif	//	__BFX_REFXMLENTITYREFERENCE_H__
